package thread;

import com.sun.org.apache.xml.internal.security.algorithms.implementations.IntegrityHmac;

import java.util.Scanner;

//static void sleep 静态方法可以时线程阻塞卡五秒
public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始。。。");
        /*
         程序启动后输入一个数字 从该数字开始每秒递减 到零时输出时间到
         */
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数");
        int in = scanner.nextInt();
        for (int i = in; i <= in; i--) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(i);
            if(i==0){
                System.out.println("程序结束");
                break;
            }
        }
        /*try {
            Thread.sleep(5000);//卡五秒
        }catch (InterruptedException e){
            e.printStackTrace();
        }*/
        System.out.println("程序结束了");
    }
}
